<template>
	<el-main>
        <el-card shadow="never" header="订单导出">
        <el-row>
            <el-col :lg="{span:12, offset: 2}">
                    <el-form :model="form" :rules="rules" :disabled="mode=='show'" ref="dialogForm" label-width="100px" label-position="left">
                        <el-form-item label="订单状态" prop="order_status">
                            <el-checkbox-group v-model="form.order_status">
                                <el-checkbox v-for="(item,index) in os"  :key="index" :md="item" :label="item.name" :value="item.value" />
                            </el-checkbox-group>
                        </el-form-item>
                        <el-form-item label="支付状态">
                             
                                <el-radio-group v-model="form.status" class="ml-4">
                                    <el-radio value="1" lable="1" size="small" border>已支付</el-radio>
                                    <el-radio value="0" label="0" size="small" border>未支付</el-radio>
                                </el-radio-group>
                             
                        </el-form-item>
                        <el-form-item label="时间" prop="create_time">
                            <el-date-picker
                                v-model="form.time"
                                value-format="yyyy-MM-dd HH:mm:ss"
                                type="datetime"
                                placeholder="请选择时间"
                            />
                        </el-form-item>
                        <el-form-item label="用户ID" prop="user_id" style="width:320px;">
                            <el-input v-model="form.user_id" clearable type="number"></el-input>
                        </el-form-item>
                        <el-form-item label="手机号" prop="phone" style="width: 320px;">
                            <el-input type="number" v-model="form.phone" clearable></el-input>
                        </el-form-item>

                        <el-button type="primary" :loading="isSaveing" @click="submit()">立即导出</el-button>
                    </el-form>
 
            </el-col>
        </el-row>
    </el-card>
	</el-main>
</template>

<script>
	export default {
		data() {
			return {
                os:[{'name':'待发货','value':0},{'name':'待收货','value':1},{'name':'申请退款','value':5},{'name':'已退款','value':6},{'name':'申请退货','value':7},{'name':'已退货','value':8},{'name':'交易完成','value':9}],
				isSaveing: false,
				//表单数据
				form: {
                    status:'1',
                    order_status:[]
                },
				//验证规则
				rules: {
					name: [
						{required: true, message: '请输入名称'}
					],
				}
			}
		},
		mounted() {
            
		},
		methods: {
			//表单提交方法
			submit(){
				this.$refs.dialogForm.validate(async (valid) => {
					if (valid) {
						this.isSaveing = true;
						var res = await this.$API.demo.order_export.post(this.form);
						this.isSaveing = false;
						if(res.code == 200){
							 
							this.$message.success("操作成功")
						}else{
							this.$alert(res.message, "提示", {type: 'error'})
						}
					}
				})
			}
	 
		}
	}
</script>

<style>
</style>
